<?php	
	// Interface function	
	function oh_module_rss($tokens) {
		global $oh_object_rss;
		return $oh_object_rss;	
	} 

	// Option file required
	require_once(dirname(__FILE__)."/magpierss-0.72/rss_fetch.inc");
	
	// Main class of module
	class oh_class_rss {		
		function oh_class_rss() {
		}
		function show($url,$limit=10) {			
			$rss = fetch_rss($url);
			$i = 0;
			foreach($rss->items as $item) {
				if ($i<$limit) {
					echo '<div class="rss">';
					echo '<div class="rss-title"><a target="_blank" href="'.$item['link'].'">'.htmlentities($item['title']).'</a></div>';
					echo '<div class="rss-text">'.htmlentities(substr($item['summary'],0,50)).'</div>';
					echo '</div>';
				}
				$i++;
			}
		}
	}
	
	// Main object of module
	global $oh_object_rss;
	$oh_object_rss = new oh_class_rss();
?>
